function! EchoCmds()
	echo $mycmds
endfunction
function! DiffCmds()
	echo $mycmds
endfunction
function! CleanCmd()
	!cd $mycdsvnp;pwd;eval "$I/antl.sh $myexecparms clean";printf "\n$mycdsvnp"
endfunction
function! SubHelloCmd(sch)
	if a:sch == "1"
		1,$s/; *System.out.println("here.*$/;/ | 1,$s/} *System.out.println("here.*$/}/
	elseif a:sch == "2"
		'b,'es/; *System.out.println("here.*$/;/ | 'b,'es/} *System.out.println("here.*$/}/
	endif
endfunction
function! DiffCmd(dch)
if a:dch == "1"
	!eval "$I/diffproj2.sh $myfullsvn -wEB 2>&1 \| tee $II/${myfn}_diff.log"
elseif a:dch == "2"
	!eval "$I/diffproj2.sh $myfullsvn -wEbB 2>&1 | tee $II/${myfn}_diff.log"
else
	!eval "$I/diffproj2.sh $myfullsvn -wEibB 2>&1 | tee $II/${myfn}_diff.log"
endif
endfunction
function! RmHereCmd(rch)
if r:dch == "1"
	1,$s/; *System.out.println("here.*$/;/ | 1,$s/} *System.out.println("here.*$/}/
elseif a:dch == "2"
	!eval "$I/diffproj2.sh $myfullsvn -wEbB 2>&1 | tee $II/${myfn}_diff.log"
else
	!eval "$I/diffproj2.sh $myfullsvn -wEibB 2>&1 | tee $II/${myfn}_diff.log"
endif
endfunction
function! GrepCmd(gch,isrc,xsrc,ctrace)
let bcmd="$I/grepf.sh "
if a:isrc != ""
	let bcmd=bcmd . " -op " . a:isrc . " "
endif
if a:xsrc != ""
	let bcmd=bcmd . " -xp " . a:xsrc . " "
endif
if a:ctrace != ""
	echo "a:isrc=" . a:isrc
	echo "bcmd=" . bcmd
endif
if a:gch == "h"
	let &grepprg=bcmd . $myfullsvn . " '*.html' -n"
elseif a:gch == "m"
	let &grepprg=bcmd . $myfullsvn . " '*.htm' -n"
elseif a:gch == "x"
	let &grepprg=bcmd . $myfullsvn . " '*.txt' -n"
elseif a:gch == "t"
	let &grepprg=bcmd . $myfullsvn . " '*.template' -n"
elseif a:gch == "j"
	let &grepprg=bcmd . $myfullsvn . " '*.java' -n"
else
	let &grepprg=bcmd . $myfullsvn . " '*.sh' -n"
endif
echo "grepprg=" . &grepprg
endfunction
function! InitTrCmd(itr,iask)
	if !exists("$mytrace")
		if a:itr == ""
			let $mytrace="n"
		else
			let $mytrace=a:itr
		endif
		if a:iask == ""
			let $myask="n"
		else
			let $mytrace=a:iask
		endif
	endif
endfunction
function! ProcAsk()
	if $myask == "y"
		let $mywgoon = input("Do you want to continue?")
	endif
endfunction
function! MakeCmd(mtarget,mpfile,mcompat,mtrace)
	echo "\$mycdsvnp=" . $mycdsvnp . ",\$mybuild1tgtparms=" . $mybuild1tgtparms . ",a:mtarget=" . a:mtarget . ",a:mpfile=" . a:mpfile
	if a:mpfile == "y"
		let $mympfile=expand("%")
		let $mympparm="-fn " . $mympfile
	else
		let $mympfile=""
		let $mympparm=""
	endif
	if a:mcompat == "y"
		let $mycurrbuild=$mybuildcompatparms
	else
		let $mycurrbuild=$mybuild1tgtparms
	endif
	let $mymtarget=a:mtarget
	let &makeprg="eval \"\$I/antcpfn.sh " . $mympparm . " " . $mycurrbuild . " " . a:mtarget . "\""
endfunction
function! ReleaseCmd(rtarget,rsign,rtrace)
	echo "\$mycdsvnp=" . $mycdsvnp . ",\$myexecparms=" . $myexecparms . ",a:rtarget=" . a:rtarget
	if a:rsign == "y"
		let $myrsign="-Dno.jar.sign=true -Dno.rim.sign=true"
	else
		let $myrsign="-Dno.jar.sign=false -Dno.rim.sign=false"
	endif
	let $myrtarget=a:rtarget
	!cd $mycdsvnp && pwd && eval "$I/antl.sh -a $myexecparms $myrsign $myrtarget" && printf "\n$myrtarget"
endfunction
function! CopyICmd()
	let $mycfile=expand("%")
	!eval "cp $mycfile $I"
	echo $mycfile
endfunction
function! MakecfnCmd(mall)
	let $mymfilepath=expand("%")
	if a:mall == "y"
		!eval "export mymfile=\"$(basename $mymfilepath)\" && $I/mkj2mefiles.sh 2>&1 | tee ${mymfile}.log"
	else
		!echo $mymfilepath && $I/mkj2mefiles.sh -f $(basename $mymfilepath) 2>&1 | tee $(basename $mymfilepath).log
	endif
	echo $mymfile
endfunction
"Define project commands.  Also init trace vars.
function! DefProjCmds()
	call InitTrCmd("","")
	command! XC call CopyICmd()
	command! Xc call CopyICmd()
	command! XM call MakecfnCmd("n")
	command! Xm call MakecfnCmd("n")
	command! XMA call MakecfnCmd("y")
	command! Xma call MakecfnCmd("y")
	command! CL call CleanCmd()
	command! Cl call CleanCmd()
	command! CF1 call DiffCmd("1")
	command! Cf1 call DiffCmd("1")
	command! CF2 call DiffCmd("2")
	command! Cf2 call DiffCmd("2")
	command! CF3 call DiffCmd("3")
	command! Cf3 call DiffCmd("3")
	command! CH call SubHelloCmd("1")
	command! Ch call SubHelloCmd("1")
	command! CHB call SubHelloCmd("2")
	command! Chb call SubHelloCmd("2")
	command! GH call GrepCmd("h","","","")
	command! Gh call GrepCmd("h","","","")
	command! GM call GrepCmd("m","","","")
	command! Gm call GrepCmd("m","","","")
	command! GT call GrepCmd("t","","","")
	command! Gt call GrepCmd("t","","","")
	command! GX call GrepCmd("x","","","")
	command! Gx call GrepCmd("x","","","")
	command! GJ call GrepCmd("j","","","")
	command! Gj call GrepCmd("j","","","")
	command! GJCP call GrepCmd("j","/compatpresrc","/src","")
	command! Gjcp call GrepCmd("j","/compatpresrc","/src","")
	command! GJT call GrepCmd("j","/testpresrc","/src","")
	command! Gjt call GrepCmd("j","/testpresrc","/src","")
	command! GS call GrepCmd("s","","","")
	command! Gs call GrepCmd("s","","","")
	if $mytrace == "y"
		echo "Changed context: \$mycdsvnp=" . $mycdsvnp . ",\$myexecparms=" . $myexecparms
	endif
endfunction
call DefProjCmds() 
if $myofn != $myfn
	GJ
elseif exists("$mytrace")
	echo "$myofn=" . $myofn
	echo "$myfn=" . $myfn
endif
